/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package jpa.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author innovapps.co
 */
@Entity
@Table(name = "laboratorista")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Laboratorista.findAll", query = "SELECT l FROM Laboratorista l"),
    @NamedQuery(name = "Laboratorista.findByIdLaboratorista", query = "SELECT l FROM Laboratorista l WHERE l.idLaboratorista = :idLaboratorista"),
    @NamedQuery(name = "Laboratorista.findByNombres", query = "SELECT l FROM Laboratorista l WHERE l.nombres = :nombres"),
    @NamedQuery(name = "Laboratorista.findByApellidos", query = "SELECT l FROM Laboratorista l WHERE l.apellidos = :apellidos")})
public class Laboratorista implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_laboratorista")
    private Integer idLaboratorista;
    @Basic(optional = false)
    @Column(name = "nombres")
    private String nombres;
    @Basic(optional = false)
    @Column(name = "apellidos")
    private String apellidos;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "laboratoristaIdLaboratorista")
    private List<Ensayo> ensayoList;

    public Laboratorista() {
    }

    public Laboratorista(Integer idLaboratorista) {
        this.idLaboratorista = idLaboratorista;
    }

    public Laboratorista(Integer idLaboratorista, String nombres, String apellidos) {
        this.idLaboratorista = idLaboratorista;
        this.nombres = nombres;
        this.apellidos = apellidos;
    }

    public Integer getIdLaboratorista() {
        return idLaboratorista;
    }

    public void setIdLaboratorista(Integer idLaboratorista) {
        this.idLaboratorista = idLaboratorista;
    }

    public String getNombres() {
        return nombres;
    }

    public void setNombres(String nombres) {
        this.nombres = nombres;
    }

    public String getApellidos() {
        return apellidos;
    }

    public void setApellidos(String apellidos) {
        this.apellidos = apellidos;
    }

    @XmlTransient
    public List<Ensayo> getEnsayoList() {
        return ensayoList;
    }

    public void setEnsayoList(List<Ensayo> ensayoList) {
        this.ensayoList = ensayoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idLaboratorista != null ? idLaboratorista.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Laboratorista)) {
            return false;
        }
        Laboratorista other = (Laboratorista) object;
        if ((this.idLaboratorista == null && other.idLaboratorista != null) || (this.idLaboratorista != null && !this.idLaboratorista.equals(other.idLaboratorista))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return apellidos + " " + nombres;
    }
    
}
